|
OBJECT COLLISION RADIUS
This command will return the radius of the collision sphere of the specified object.
Return Float=OBJECT COLLISION RADIUS(Object Number)
Object Number
Integer
The object number
The radius of the collision sphere of the specified object
The radius is returned as a real value, and the object is specified using an integer value.
sync on : sync rate 60 : hide mouse:cls 0
autocam off
set global collision on
ObjectNumber=1
SecondObject=2
make object sphere ObjectNumber,10
color object ObjectNumber,rgb(0,255,0)
position object ObjectNumber, 0,0,0
make object cone secondObject,10
xrotate object secondObject,90
fix object pivot secondObject
color object SecondObject,rgb(255,0,0)
position object SecondObject, 15,0,0
while mouseclick()=0
set cursor 0,0
set object collision to boxes ObjectNumber
set object collision to boxes SecondObject
set object radius ObjectNumber,5
set object radius SecondObject,5
if leftkey()=1 then turn object left SecondObject,1
if rightkey()=1 then turn object right SecondObject,1
if upkey()=1 and OBJECT HIT(SecondObject,0)=0 then move object SecondObject,1
if downkey()=1 and OBJECT HIT(SecondObject,0)=0 then move object SecondObject,-1
if returnkey()=1 then position object SecondObject,15,0,0
if OBJECT COLLISION(SecondObject,0)
print "OBJECT COLLISION"
print "OBJECT COLLISION RADIUS",OBJECT COLLISION RADIUS(ObjectNumber)
endif
position camera object position x(SecondObject),object position y(SecondObject)+50,object position z(SecondObject)
point camera object position x(SecondObject),0,object position z(SecondObject)
sync
endwhile
set global collision off
delete object ObjectNumber
delete object SecondObject
end
BASIC3D Commands Menu
Index
|